(function(e){var b=window.AmazonUIPageJS||window.P,c=b._namespace||b.attributeErrors,g=c?c("VSE-aui",""):b;g.guardFatal?g.guardFatal(e)(g,window):g.execute(function(){e(g,window)})})(function(e,b,c){(function(){function g(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(f){var a=16*Math.random()|0;return("x"==f?a:a&3|8).toString(16)})}b.vseFeatures=b.vseFeatures||{};var c=b.gatedP||{register:function(f,a,h,d,c){void 0===c&&(c=b.vseFeatures);e.now(f).execute(f+"-prereg",function(b){b|| c[a]||(c[a]=!0,d.resolve(h(d)).then(function(){e.now(f).execute(f+"-reg",function(b){b||(e.log("Gated registration failed to register module!","ERROR",f),c[a]=!1)})}))})},declare:function(f,a,c,d){void 0===d&&(d=b.vseFeatures);e.now(f).execute(f+"-prereg",function(b){b||d[a]||(d[a]=!0,e.declare(f,c))})}};b.gatedP||(e.declare("vse-gatedP",c),b.gatedP=c);c.declare("vse-metricUtils","vse-metricUtils-registred",{makeApplicationSushiPayloadBuilder:function(c,a){return function(e){var d={eventSource:a.eventSource, requestId:a.requestId,sessionId:a.sessionId,placementContext:a.placementContext,marketplaceId:a.marketplaceId,weblabIds:a.weblabIds,clientId:a.clientId,isInternal:a.isInternal.toString(),isRobot:a.isRobot.toString(),pageAsin:a.pageAsin,customerId:a.customerId,sessionType:a.sessionType||1,refMarkers:a.refMarkers,eventId:g(),timestamp:new Date,userAgentData:navigator.userAgent,titleSessionId:0,videoAsin:0,pageUrl:null!==b.location.href?b.location.href.substring(0,500):"",videoAsinList:a.videoAsinList|| ""};return{events:[{data:c.$.extend(d,e)}]}}}});Array.prototype.indexOf||(Array.prototype.indexOf=function(b,a){if(null==this)throw new TypeError('"this" is null or not defined');var c=Object(this),d=c.length>>>0;if(0===d)return-1;a|=0;if(a>=d)return-1;for(a=Math.max(0<=a?a:d-Math.abs(a),0);af)return 1;if(ea.length&&0a.length)){for(var b=1,d=a[0];bthis.heartbeatWatchTotalDuration||3<=a)){this.ospAttributionTag=K();var b=this;g.when("A").execute("Emit-VSE-OSP-Attribtion", function(a){a.post(b.ospAttributionTag,{success:c,error:e})});var c=function(){b.handleOspAttributionReport=t},e=function(){A(++a)}}}.bind(this),t=function(){}.bind(this),L=function(a){this.pageLoadStartTime=a}.bind(this),x=function(){this.handleOspAttributionReport();var a=e("primary.viewedDuration","",Math.round(1E3*this.heartbeatWatchTotalDuration));c(a)}.bind(this),M=function(){var a=this.player.currentTime();this.heartbeatWatchTotalDuration+=a-this.heartbeatWatchSegStartTime;x();this.heartbeatWatchSegStartTime= a;this.heartbeatSystemStartTime=Date.now()}.bind(this),N=function(a){var b=this.player.currentTime()-this.heartbeatWatchSegStartTime;this.heartbeatWatchTotalDuration+=b;clearInterval(this.heartbeatWatchInterval);this.heartbeatWatchInterval=null;if(a&&(a=Math.round(1E3*b),b=Date.now()-this.heartbeatSystemStartTime,2200a||ab+200))return;x()}.bind(this),Q=function(){this.isSegmentStarted=!0;this.segmentStartTime=this.player.currentTime();null===this.heartbeatWatchInterval&&(this.heartbeatWatchSegStartTime= this.player.currentTime(),this.heartbeatSystemStartTime=Date.now(),this.heartbeatWatchInterval=setInterval(M,2E3));O(P)}.bind(this),u=function(a){this.isSegmentStarted&&(this.isSegmentStarted=!1,p("playheadInterval"),p("rebufferDetectionInterval"),null!==this.heartbeatWatchInterval&&N(a),a=this.player.currentTime(),this.segmentStartTime!==h&&a!==this.prevSegmentStopTime&&(this.segmentDuration=a-this.segmentStartTime,this.totalDuration+=this.segmentDuration,this.prevSegmentStopTime=a))}.bind(this), R=function(){var a=this.player.currentTime();a===this.prevPlayHeadTime&&0!==this.prevPlayHeadTime&&this.player.trigger("rebuffering");this.prevPlayHeadTime=a}.bind(this),P=function(){this.rebufferDetectionInterval===h&&(this.prevPlayHeadTime=this.player.currentTime(),p("rebufferDetectionInterval"),this.rebufferDetectionInterval=setInterval(R,250))}.bind(this),O=function(a){if(this.playheadInterval===h){var b=this.player.currentTime(),c=function(){try{this.player.currentTime()>b+.05&&(p("playheadInterval"), a())}catch(c){p("playheadInterval"),q.error("vse-brila-metrics","Exception in heartbeat function for detecting playhead movement.",c)}}.bind(this);this.playheadInterval=setInterval(c,10)}}.bind(this),S=function(){1<=this.rebufferCount?b.addMetric("qos.primary.","rebufferOccurred",1,b.METRIC_TYPES.COUNT):b.addMetric("qos.primary.","rebufferOccurred",0,b.METRIC_TYPES.COUNT)}.bind(this),T=function(){if(this.seekingTime>this.lastUpdatedTime){this.skipForwardCount+=1;var a=e("primary.skipForward","",1); c(a)}else this.seekingTime.75*this.mediaDuration&&!this.thirdQuartileReached){b.addMetric("engagement.primary.","firstQuartileCount",1,b.METRIC_TYPES.COUNT);b.addMetric("engagement.primary.","midpointCount",1,b.METRIC_TYPES.COUNT);b.addMetric("engagement.primary.","thirdQuartileCount",1,b.METRIC_TYPES.COUNT);var a=e("primary.thirdQuartileCount","",1);c(a); this.firstQuartileReached=this.midpointReached=this.thirdQuartileReached=!0}else this.player.currentTime()>.5*this.mediaDuration&&!this.midpointReached?(b.addMetric("engagement.primary.","firstQuartileCount",1,b.METRIC_TYPES.COUNT),b.addMetric("engagement.primary.","midpointCount",1,b.METRIC_TYPES.COUNT),a=e("primary.midpointCount","",1),c(a),this.firstQuartileReached=this.midpointReached=!0):this.player.currentTime()>.25*this.mediaDuration&&!this.firstQuartileReached&&(b.addMetric("engagement.primary.", "firstQuartileCount",1,b.METRIC_TYPES.COUNT),a=e("primary.firstQuartileCount","",1),c(a),this.firstQuartileReached=!0)}.bind(this),Y=function(){var a=Date.now();if(this.isRebuffering){var d=a-this.rebufferStartTime;this.rebufferDuration+=d;this.isRebuffering=!1;d=e("primary.rebufferInstance","",d);c(d)}Q();a-=this.pageLoadStartTime;this.primaryStartReached||(b.addMetric("engagement.primary.","startCount",1,b.METRIC_TYPES.COUNT),b.publish(),d=e("primary.startCount","",1),c(d),this.primaryStartReached= !0);this.playToFirstFrameFlag&&(this.isEnded=!1,this.pageLoadStartTime!=this.prePageLoadStartTimestamp&&(b.addMetric("qos.","playToFirstFrameDuration",a,b.METRIC_TYPES.DURATION_MILLIS),this.prePageLoadStartTimestamp=this.pageLoadStartTime,d=e("playToFirstFrameDuration","",a),c(d)),b.publish(),this.playToFirstFrameFlag=!1,this.mediaDuration=this.player.duration())}.bind(this),Z=function(){this.seekingTime=this.player.currentTime();p("playheadInterval");p("rebufferDetectionInterval");this.seekingTime== this.pauseTime&&(this.totalDuration-=this.pauseTime-this.lastUpdatedTime,this.heartbeatWatchTotalDuration-=this.pauseTime-this.lastUpdatedTime,x(),T())}.bind(this),aa=function(){this.pauseTime=this.player.currentTime();u(!0)}.bind(this),ba=function(){u(!1);this.rebufferStartTime=Date.now();this.isRebuffering=!0;this.rebufferCount+=1}.bind(this),ca=function(){this.isEnded=!0;b.setContentId(this.contentId);var a=e("primary.complete","",1);c(a);b.addMetric("engagement.primary.","completeCount",1,b.METRIC_TYPES.COUNT); w()}.bind(this),da=function(){var a=this.player.error().code,d=e("","",1);1==a||2==a?(b.addMetric("error.primary.","response.loadCount",1,b.METRIC_TYPES.COUNT),d.events[0].data.eventName="primary.loadError"):3==a||5==a?(b.addMetric("error.primary.","response.interpretCount",1,b.METRIC_TYPES.COUNT),d.events[0].data.eventName="primary.interpretError"):4==a?(b.addMetric("error.primary.","videoUnsupportedCount",1,b.METRIC_TYPES.COUNT),d.events[0].data.eventName="primary.videoUnsupportedError"):(b.addMetric("error.primary.", "undefinedCount",1,b.METRIC_TYPES.COUNT),d.events[0].data.eventName="primary.undefinedError");b.publish();c(d)}.bind(this),z={requestplay:z,requestpause:U,requestmute:V,requestunmute:W,timeupdate:X,playing:Y,seeking:Z,pause:aa,rebuffering:ba,ended:ca,error:da},v=function(a){return null===a||a===h},y=function(a){return"[object String]"===toString.call(a)},ea=function(){var a=navigator.userAgent.match(r),b=!1;g.now("mash").execute("vse-detect-mshop",function(a){b=!0});return a&&b},fa=function(a,d,c){return{titleSessionId:b.titleSessionId, eventName:a,stringPayload:d,intPayload:c,videoAsin:this.contentId,refMarkers:this.refTag}}.bind(this),e=function(a,b,c){return this.buildSushiPayload?this.buildSushiPayload(fa(a,b,c)):{}}.bind(this),c=function(a,b){that=this;if(!(v(this.sushiEndpoint)||""===this.sushiEndpoint||(b=b||0,3<=b))){var e=JSON.stringify(a).replace(/\\\\/g,""),f={params:e,paramsFormat:"json",contentType:"application/json; charset\x3dutf-8",error:h};g.when("A").execute("Emit-VSE-Metrics",function(a){!navigator||!navigator.sendBeacon|| ea()||navigator.userAgent.match(H)&&navigator.userAgent.match(I)?a.post(that.sushiEndpoint,f):navigator.sendBeacon(that.sushiEndpoint,e)});var h=function(){c(a,++b)}}}.bind(this);this.bindEventHandlers=function(a){for(var b in a)this.player.on(b,a[b])}.bind(this);this.unbindEventHandlers=function(a){for(var b in a)this.player.off(b,a[b])}.bind(this);J(l);this.bindEventHandlers(z);(function(){var a=navigator.userAgent.match(r),b=navigator.userAgent.match(F),c=!navigator.userAgent.match(G);return a&& b&&c})()?k.onpagehide=function(){null!==this.player&&this.publishBeforeDispose()}.bind(this):k.onbeforeunload=function(){null!==this.player&&this.publishBeforeDispose()}.bind(this)},_noneFeature:l()}})})},q)});g.when("videojs-plugin","brila-metrics-constructor","3p-promise").execute("gated-register-metrics",function(h,l,k){gatedP.register("brila-metrics-plugin","brila-metrics-plugin-registered",function(k){return new k(function(k,q){g.register("brila-metrics-plugin",function(){return{obj:h.register("brilaMetrics", l.obj),_noneFeature:k()}})})},k)})}); /* ******** */ (function(k){var n=window.AmazonUIPageJS||window.P,h=n._namespace||n.attributeErrors,f=h?h("BrilaHotkeys",""):n;f.guardFatal?f.guardFatal(k)(f,window):f.execute(function(){k(f,window)})})(function(k,n,h){k.when("brila-videojs","videojs-plugin","3p-promise").execute("gated-register-hotkeys-plugin",function(f,h,l){gatedP.register("brila-hotkeys-plugin","brila-hotkeys-plugin-registered",function(l){return new l(function(l,B){k.register("brila-hotkeys-plugin",function(){f=f.obj;return{obj:h.register("brilaHotkeys", function(a,c){h.super(this,a,c);var e=a.el(),k=document;c=(f.mergeOptions||f.util.mergeOptions)({volumeStep:.1,seekStep:5,enableMute:!0,enableVolumeScroll:!0,enableFullscreen:!0,enableNumbers:!0,enableJogStyle:!1,alwaysCaptureHotkeys:!1,enableModifiersForNumbers:!0,enableInactiveFocus:!0,skipInitialFocus:!1,playPauseKey:function(b){return 32===b.which||179===b.which},rewindKey:function(b){return 37===b.which||177===b.which},forwardKey:function(b){return 39===b.which||176===b.which},volumeUpKey:function(b){return 38=== b.which},volumeDownKey:function(b){return 40===b.which},muteKey:function(b){return 77===b.which},fullscreenKey:function(b){return 70===b.which},customKeys:{}},c||{});var l=c.volumeStep,r=c.seekStep,v=c.enableMute,w=c.enableVolumeScroll,t=c.enableFullscreen,x=c.enableNumbers,u=c.enableJogStyle,p=c.alwaysCaptureHotkeys,y=c.enableModifiersForNumbers,q=c.enableInactiveFocus,z=c.skipInitialFocus;e.hasAttribute("tabIndex")||e.setAttribute("tabIndex","-1");e.style.outline="none";if((p||a.tech_.autoplay&& !a.autoplay())&&!z)a.one("play",function(){e.focus()});if(q)a.on("userinactive",function(){var b=function(){clearTimeout(c)},c=setTimeout(function(){a.off("useractive",b);k.activeElement.parentElement==e.querySelector(".vjs-control-bar")&&e.focus()},10);a.one("useractive",b)});a.on("play",function(){var b=e.querySelector(".iframeblocker");b&&""===b.style.display&&(b.style.display="block",b.style.bottom="39px")});var q=function(b){if(a.controls()){var c=b.relatedTarget||b.toElement||k.activeElement; (p||c==e||c==e.querySelector(".vjs-tech")||c==e.querySelector(".iframeblocker")||c==e.querySelector(".vjs-control-bar"))&&w&&(b=n.event||b,c=Math.max(-1,Math.min(1,b.wheelDelta||-b.detail)),b.preventDefault(),1==c?a.volume(a.volume()+l):-1==c&&a.volume(a.volume()-l))}},A=function(b,a){if(c.playPauseKey(b,a))return 1;if(c.rewindKey(b,a))return 2;if(c.forwardKey(b,a))return 3;if(c.volumeUpKey(b,a))return 4;if(c.volumeDownKey(b,a))return 5;if(c.muteKey(b,a))return 6;if(c.fullscreenKey(b,a))return 7}; a.on("keydown",function(b){var f=b.which,m,d;d=b.preventDefault;var g=a.duration();if(a.controls()){var h=k.activeElement;if(p||h==e||h==e.querySelector(".vjs-tech")||h==e.querySelector(".vjs-control-bar")||h==e.querySelector(".iframeblocker"))switch(A(b,a)){case 1:d();p&&b.stopPropagation();a.paused()?a.play("hotkeys",b):a.pause("hotkeys",b);break;case 2:m=!a.paused();d();m&&a.pause("hotkeys",b);d=a.currentTime()-r;a.currentTime()<=r&&(d=0);a.currentTime(d);m&&a.play("hotkeys",b);break;case 3:m= !a.paused();d();m&&a.pause("hotkeys",b);d=a.currentTime()+r;d>=g&&(d=m?g-.001:g);a.currentTime(d);m&&a.play("hotkeys",b);break;case 5:d();u?(d=a.currentTime()-1,1>=a.currentTime()&&(d=0),a.currentTime(d)):a.volume(a.volume()-l);break;case 4:d();u?(d=a.currentTime()+1,d>=g&&(d=g),a.currentTime(d)):a.volume(a.volume()+l);break;case 6:v&&a.muted(!a.muted());break;case 7:t&&(a.isFullscreen()?a.exitFullscreen():a.requestFullscreen());break;default:for(m in(47f||95f)&&(y||!(b.metaKey||b.ctrlKey|| b.altKey))&&x&&(g=48,95 * Copyright Brightcove, Inc. * Available under Apache License Version 2.0 * * * Includes vtt.js * Available under Apache License Version 2.0 * */ /** * We are using the already-minified videojs 7.5.5 asset as * a base to avoid the BuzzClosureCompiler issues related to * https://issues.amazon.com/issues/VA-18103 . Follow-up work * to replace this with a minifier in BrilaVideojsReleases * builder to maintain a legible asset is planned. */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("global/window"),require("global/document")):"function"==typeof define&&define.amd?define(["global/window","global/document"],t):(e=e||self).videojs=t(e.window,e.document)}(this,function(v,h){v=v&&v.hasOwnProperty("default")?v.default:v,h=h&&h.hasOwnProperty("default")?h.default:h;var d="7.5.5";function p(e,t){e.prototype=Object.create(t.prototype),(e.prototype.constructor=e).__proto__=t}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(e,t,i){return(s=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}()?Reflect.construct:function(e,t,i){var n=[null];n.push.apply(n,t);var r=new(Function.bind.apply(e,n));return i&&a(r,i.prototype),r}).apply(null,arguments)}function f(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function t(e,t){return t||(t=e.slice(0)),e.raw=t,e}var u=[],e=function(s,o){return function(e,t,i){var n=o.levels[t],r=new RegExp("^("+n+")$");if("log"!==e&&i.unshift(e.toUpperCase()+":"),i.unshift(s+":"),u&&u.push([].concat(i)),v.console){var a=v.console[e];a||"debug"!==e||(a=v.console.info||v.console.log),a&&n&&r.test(e)&&a[Array.isArray(i)?"apply":"call"](v.console,i)}}};var m=function t(i){var n,r="info",a=function(){for(var e=arguments.length,t=new Array(e),i=0;i',i=n.firstChild,n.setAttribute("style","display:none; position:absolute;"),h.body.appendChild(n));for(var a={},s=0;sx',e=t.firstChild.href}return e},Kt=function(e){if("string"==typeof e){var t=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/i.exec(e);if(t)return t.pop().toLowerCase()}return""},$t=function(e){var t=v.location,i=Xt(e);return(":"===i.protocol?t.protocol:i.protocol)+i.host!==t.protocol+t.host},Qt=Object.freeze({parseUrl:Xt,getAbsoluteURL:Yt,getFileExtension:Kt,isCrossOrigin:$t}),Jt=function(e){var t=Zt.call(e);return"[object Function]"===t||"function"==typeof e&&"[object RegExp]"!==t||"undefined"!=typeof window&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)},Zt=Object.prototype.toString;var ei=Pt(function(e,t){(t=e.exports=function(e){return e.replace(/^\s*|\s*$/g,"")}).left=function(e){return e.replace(/^\s*/,"")},t.right=function(e){return e.replace(/\s*$/,"")}}),ti=(ei.left,ei.right,Function.prototype.toString),ii=/^\s*class\b/,ni=function(e){try{var t=ti.call(e);return ii.test(t)}catch(e){return!1}},ri=Object.prototype.toString,ai="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag,si=function(e){if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;if("function"==typeof e&&!e.prototype)return!0;if(ai)return function(e){try{return!ni(e)&&(ti.call(e),!0)}catch(e){return!1}}(e);if(ni(e))return!1;var t=ri.call(e);return"[object Function]"===t||"[object GeneratorFunction]"===t},oi=Object.prototype.toString,ui=Object.prototype.hasOwnProperty,li=function(e,t,i){if(!si(t))throw new TypeError("iterator must be a function");var n;3<=arguments.length&&(n=i),"[object Array]"===oi.call(e)?function(e,t,i){for(var n=0,r=e.length;n=e?t.push(r):r.startTime===r.endTime&&r.startTime<=e&&r.startTime+.5>=e&&t.push(r)}if(o=!1,t.length!==this.activeCues_.length)o=!0;else for(var a=0;a","‎":"‎","‏":"‏"," ":" "},Ui={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},xi={v:"title",lang:"lang"},Di={rt:"ruby"};function Ri(a,i){function e(){if(!i)return null;var e,t=i.match(/^([^<]*)(<[^>]*>?)?/);return e=t[1]?t[1]:t[2],i=i.substr(e.length),e}function t(e){return Ii[e]}function n(e){for(;f=e.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)e=e.replace(f[0],t);return e}function r(e,t){var i=Ui[e];if(!i)return null;var n=a.document.createElement(i);n.localName=i;var r=xi[e];return r&&t&&(n[r]=t.trim()),n}for(var s,o,u,l=a.document.createElement("div"),c=l,h=[];null!==(s=e());)if("<"!==s[0])c.appendChild(a.document.createTextNode(n(s)));else{if("/"===s[1]){h.length&&h[h.length-1]===s.substr(2).replace(">","")&&(h.pop(),c=c.parentNode);continue}var d,p=Ai(s.substr(1,s.length-2));if(p){d=a.document.createProcessingInstruction("timestamp",p),c.appendChild(d);continue}var f=s.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!f)continue;if(!(d=r(f[1],f[3])))continue;if(o=c,Di[(u=d).localName]&&Di[u.localName]!==o.localName)continue;f[2]&&(d.className=f[2].substr(1).replace("."," ")),h.push(f[1]),c.appendChild(d),c=d}return l}var Mi=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function Bi(e){for(var t=0;t=i[0]&&e<=i[1])return!0}return!1}function Ni(){}function ji(e,t,i){Ni.call(this),this.cue=t,this.cueDiv=Ri(e,t.text);var n={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(n,this.cueDiv),this.div=e.document.createElement("div"),n={direction:function(e){var t=[],i="";if(!e||!e.childNodes)return"ltr";function r(e,t){for(var i=t.childNodes.length-1;0<=i;i--)e.push(t.childNodes[i])}function a(e){if(!e||!e.length)return null;var t=e.pop(),i=t.textContent||t.innerText;if(i){var n=i.match(/^.*(\n|\r)/);return n?n[e.length=0]:i}return"ruby"===t.tagName?a(e):t.childNodes?(r(e,t),a(e)):void 0}for(r(t,e);i=a(t);)for(var n=0;nh&&(c=c<0?-1:1,c*=Math.ceil(h/l)*l),r<0&&(c+=""===n.vertical?o.height:o.width,a=a.reverse()),i.move(d,c)}else{var p=i.lineHeight/o.height*100;switch(n.lineAlign){case"middle":r-=p/2;break;case"end":r-=p}switch(n.vertical){case"":t.applyStyles({top:t.formatStyle(r,"%")});break;case"rl":t.applyStyles({left:t.formatStyle(r,"%")});break;case"lr":t.applyStyles({right:t.formatStyle(r,"%")})}a=["+y","-x","+x","-y"],i=new Fi(t)}var f=function(e,t){for(var i,n=new Fi(e),r=1,a=0;ae.left&&this.tope.top},Fi.prototype.overlapsAny=function(e){for(var t=0;t=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right},Fi.prototype.overlapsOppositeAxis=function(e,t){switch(t){case"+x":return this.lefte.right;case"+y":return this.tope.bottom}},Fi.prototype.intersectPercentage=function(e){return Math.max(0,Math.min(this.right,e.right)-Math.max(this.left,e.left))*Math.max(0,Math.min(this.bottom,e.bottom)-Math.max(this.top,e.top))/(this.height*this.width)},Fi.prototype.toCSSCompatValues=function(e){return{top:this.top-e.top,bottom:e.bottom-this.bottom,left:this.left-e.left,right:e.right-this.right,height:this.height,width:this.width}},Fi.getSimpleBoxPosition=function(e){var t=e.div?e.div.offsetHeight:e.tagName?e.offsetHeight:0,i=e.div?e.div.offsetWidth:e.tagName?e.offsetWidth:0,n=e.div?e.div.offsetTop:e.tagName?e.offsetTop:0;return{left:(e=e.div?e.div.getBoundingClientRect():e.tagName?e.getBoundingClientRect():e).left,right:e.right,top:e.top||n,height:e.height||t,bottom:e.bottom||n+(e.height||t),width:e.width||i}},Hi.StringDecoder=function(){return{decode:function(e){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}},Hi.convertCueToDOMTree=function(e,t){return e&&t?Ri(e,t):null};Hi.processCues=function(n,r,e){if(!n||!r||!e)return null;for(;e.firstChild;)e.removeChild(e.firstChild);var a=n.document.createElement("div");if(a.style.position="absolute",a.style.left="0",a.style.right="0",a.style.top="0",a.style.bottom="0",a.style.margin="1.5%",e.appendChild(a),function(e){for(var t=0;t